document.addEventListener('DOMContentLoaded',function (){
    // 提示框
    var pwd = document.querySelector('.pwd');
    var celpwd = document.querySelector('.celpwd');
    var inputs = document.querySelectorAll('input');
    console.log(pwd);
    console.log(celpwd);
    console.log(inputs);
    function ifpan(obj,length)
    {
        if(length>=8)
        {
            obj.style.display = 'none';
        }else {
            obj.style.display = 'block';
        }
    }
    inputs[1].addEventListener('focus', function (){
        if(this.value === '')
        {
            pwd.style.display = 'block';
        }
        ifpan(pwd,this.value.length);
    });
    inputs[1].addEventListener('blur', function (){
        ifpan(pwd,this.value.length);
    });
    inputs[2].addEventListener('focus', function (){
        if(this.value === '')
        {
            celpwd.style.display = 'block';
        }
        ifpan(celpwd,this.value.length);
    });
    inputs[2].addEventListener('blur', function (){
        ifpan(celpwd,this.value.length);
        if(inputs[1].value !== this.value)
        {
            alert('密码不一致！请重新输入！');
            this.value = '';
        }
    });
});